package com.zqh.useraddrquery.controller;

import com.zqh.myfmmall.entity.UserAddr;
import com.zqh.myfmmall.result.Result;
import com.zqh.useraddrquery.service.AddrQueryService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-02-18 2:15
 */
@RestController
@RequestMapping("addr")
public class AddrQueryController{
    @Resource
    private AddrQueryService addrQueryService;

    @PostMapping("retrieveByUid")
    public Result getByUid(@RequestBody String userId){
        return addrQueryService.getByUserId(userId);
    }

    @GetMapping("retrieve/{addrId}")
    public Result getById(@PathVariable("addrId") String id){
        UserAddr userAddr = addrQueryService.getById(id);
        return Result.success(userAddr);
    }
}
